<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no,minimal-ui">
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
    <meta name="apple-mobile-web-app-title" content="阿福易购">
    <meta content="telephone=no" name="format-detection" />
    <meta content="email=no" name="format-detection" />
    <!-- uc、qq浏览器 -->
    <meta name="screen-orientation" content="portrait">
    <meta name="full-screen" content="yes">
    <meta name="browsermode" content="application">
    <meta name="x5-orientation" content="portrait">
    <meta name="x5-fullscreen" content="true">
    <meta name="x5-page-mode" content="app">
    <meta name="HandheldFriendly" content="true">
    <meta name="MobileOptimized" content="320">
    <meta name="keywords" content="{{$SEO['keywords']}}"/>
    <meta name="description" content="{{$SEO['description']}}"/>
    <meta name="csrf-token" content="{{ csrf_token() }}" />
    <title>申请售后_{{$SEO['title']}}</title>
    <link rel="stylesheet" href="{{ asset('/build/css/app.min.css') }}">
</head>
<body ontouchstart="">


@inject('orderService','App\Interfaces\OrderService')

@inject('pictureService','App\Interfaces\PictureService')

@inject('refundGoodsService','App\Interfaces\RefundGoodsService')


<header class="ui-header ui-header-stable  af-header">
    <ul class="ui-row-flex">
        <li class="ui-col ui-flex ui-flex-pack-start">
            <i ontouchstart="window.history.back();" class="ui-icon-return"></i>
        </li>
        <li class="ui-col ui-flex ui-flex-pack-center">
            <h1>申请售后</h1>
        </li>
        <li class="ui-col ui-flex ui-flex-pack-end">
        </li>
    </ul>
</header>

<div class="ui-container">

    @foreach($orders as $orderInfo)
    <?php
    // dd($orderInfo->toArray());
    ?>
    <div class="ui-my-order ui-border-tb">

        <ul class="ui-list ui-list-pure ui-border-tb" style="margin-bottom: 10px;">
            <li class="ui-border-t">
                <p>订单编号：{{$orderInfo->order_sn}}<span class="ui-txt-highlight" style="float: right">
                <?php
                    switch($orderInfo->order_status){

                        case '1':
                            echo '待支付';
                            break;

                        case '2':
                            echo '待发货';
                            break;

                        case '3':
                            echo '已发货';
                            break;

                        case '4':
                            echo '已完成';
                            break;

                        case '5':
                            echo '已取消';
                            break;

                        case '6':
                            echo '已退款';
                            break;
                    }
                ?>
                </span></p>
                <p class="ui-txt-muted">订单时间：{{$orderInfo->add_time}}</p>
            </li>
        </ul>
        <div class="ui-my-order-comment">
            <ul class="ui-list ui-list-function ui-border-tb">
                <?php $orderGoods=$orderService->getOrderGoods($orderInfo->order_id); ?>
                @foreach($orderGoods as $item)

                <li class="ui-border-t">
                    <div data-href="/goods/show/{{$item->goods_id}}" class="ui-list-img">
                        <span style="background-image:url({{$pictureService::thumb($item->goods_thumb, 70, 70)}})"></span>
                    </div>
                    <div class="ui-list-info">
                        <a href="/goods/show/{{$item->goods_id}}">
                            <h4 class="ui-nowrap ui-txt-default">{{$item->goods_name}}</h4>
                            <p class="ui-nowrap ui-txt-info"><small>{{$item->goods_pet_name}}</small></p>
                        </a>
                    </div>

                    <?php

                        $isHas = $refundGoodsService->isHasRefund($orderInfo->order_sn, $item->goods_id);
                    ?>


                    @if(empty($isHas))
                    <div class="ui-btn ui-btn-gray" data-href="{{route('wap.my.refund.apply',[$orderInfo->order_sn,$item->goods_id])}}">
                    申请
                    </div>
                    @else
                    <?php

                        $refundGoods = $refundGoodsService->getByOrderSnGoodsSn($orderInfo->order_sn, $item->goods_sn);
                    ?>
                    <div class="ui-btn ui-btn-gray" data-href="/wap/my/refund/{{$refundGoods->refund_sn}}">
                    已申请
                    </div>
                    @endif

                </li>
                @endforeach
            </ul>
        </div>
    </div>
    @endforeach

</div>

<script src="{{ asset('/build/lib/zepto.min.js') }}"></script>
<script src="{{ asset('/build/js/frozen.js') }}"></script>
<script src="{{ asset('/build/js/app.min.js') }}"></script>
</body>
</html>